home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5784 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  4.4 KB

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Which C compiler?
  5. Date: 20 Feb 1996 13:57:28 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4gdg48INN84g@keats.ugrad.cs.ubc.ca>
  8. References: <56c21b5c56c21b5c@iconet.hongkong.net>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <56c21b5c56c21b5c@iconet.hongkong.net>,
  12. Wong Yuk Wah <Wong.Yuk.Wah%f18.n1000.z128@iconet.hongkong.net> wrote:
  13. >Hi!
  14. >
  15. >I'm a beginner in C programming. Just having learnt the basic concept of C,
  16. >I found I still couldn't write a *real* program. The ANSI standard doesn't
  17. >provide the variety of functions that a usual program needs, such as text
  18. >color, graphics, and that kind of interface stuff.
  19.  
  20. For these kinds of things, you leave ANSI behind and go for platform-specific
  21. options. There are *many* ways of writing interactive programs on various
  22. platforms. Some of these are more standardized and widely accepted than others.
  23. Under UNIX, for instance, if you use the "Xlib" library, your program will
  24. probably work with little or no modification just about everywhere where the
  25. X11 standard is supported (which is just about everywhere...). 
  26.  
  27. >So I'm facing a problem. The fact is that I'm using Turbo C++ 3.00 for
  28. >learning purpose. There's lots of libraries helping achieve the desired
  29. >effects, such as BGI. But BGI certainly won't be included in Microsoft 
  30. >C/C++ (not mentioning Visual C++ that I *cannot* use!). So I think
  31. >switching from a C implementation to another is rather difficult. But what
  32. >implementation should I choose? There are so many different versions of
  33. >C/C++, like Borland, Turbo, Microsoft, Symantec, and so on. After I've
  34. >made my choice, I want to stick to it. But the problem is which one I
  35. >should choose.
  36.  
  37. For learning purposes, I don't see whether it really matters. The 16-bit DOS
  38. environment is obsolete.
  39.  
  40. I don't advocate Windows platforms (so don't get me wrong), but it is apparent
  41. that Bill Gates wants to you to write Win32 programs which will work under
  42. Windows NT and Windows95. The Win32 API supposedly gives you all kinds of
  43. functions to enable you to do what you are asking for. I wouldn't know the
  44. details, being a UNIX user, but if you feel that your computing future consists
  45. of working with Microsoft platforms, you might as well learn Win32 from the
  46. start.
  47.  
  48. Of course, you could also use the GNU C compiler under Linux or FreeBSD to
  49. learn C coding. These systems have interfaces based on open standards. For
  50. example, the operating system calls are implemented largely according to the
  51. POSIX.1 standard, as well as other established standards used by the UNIX
  52. community (BSD, SVR4, XPG), where POSIX.1 doesn't reach. Although if you use
  53. POSIX calls, your program is not strict ANSI, it _is_ at least governed by a
  54. widely accepted standard. It's possible to write interactive *character-based*
  55. programs using just POSIX, because POSIX defines ways to control terminal
  56. devices to establish character-at-a-time input (something not provided by the
  57. ANSI/ISO C standard).  
  58.  
  59. A good candidate for doing graphics work is OpenGL, particularly if you are
  60. interested in 3D visualization. 
  61.  
  62. >Can anyone tell me what is more suitable? By the way, I learnt from books
  63. >that C is famous for its portability. How's the portability differs among
  64. >the various versions? 
  65.  
  66. The portability is up to you, the programmer. If you carefully write a program
  67. that strictly conforms to the standard, it will be accepted by a conforming C
  68. implementation. On the other hand, you can exploit the particular machine
  69. architecture you are working on at the expense of sacrificing portability.
  70.  
  71. I wouldn't say that C is famous for its portability, except in the sense that
  72. it is "famous", in general, and well standardized. It's possible to write
  73. horribly non-portable code in C. The C language enviroments have a license to
  74. implement operations in a way that is efficiently translated to the local
  75. machine code. If you want to write truly portable code, you have to, for
  76. instance, give up the idea that operations on signed integers always behave the
  77. way you would expect them on, say, a VAX or 80386, or that a long integer's bit
  78. image is equivalent to so many characters, in such and such an order.  For each
  79. non-trivial statement you write, you have to consider whether its meaning is
  80. unspecified, undefined or implementation-defined, and write accordingly. 
  81. -- 
  82.  
  83.